package gaml.text.printer;

import gaml.core.GamlConfig;
import gaml.error.GamlException;
import gaml.text.YamlLine;
import gaml.text.YamlNodePrinter;
import gaml.text.YamlText;
import gaml.yaml.AliasNode;


/**
 * create a text representation of alias node
 * @author shnireck
 *
 */
public class AliasNodePrinter implements YamlNodePrinter <AliasNode> {
	GamlConfig config = null;
	
	public AliasNodePrinter (GamlConfig config) { this.config = config; }

	@Override
	public Class <AliasNode> getPrintNodeClass () { return AliasNode.class; }

	@Override
	public YamlNodePrinter <AliasNode> print (AliasNode node, YamlText text) throws GamlException {
		text.addLine (new YamlLine ().setValue ((node.isEmpty () ? "" : String.format ("*%s", node.getAnchor ().getCode ()))));

		return this;
	}
}